﻿#pragma once
/**
@author 何炜
@date 2011/4/27
@brief .
@details
@coding utf8
*/

#include "GLLSystem.h"
#include "GLLSingleton.h"
#include "GLLLvlObj.h"
#include "GLLLevel.h"

namespace GLL
{	
	class VirtualWorld;

	class LevelManager : public System
	{
		friend void boost::checked_delete(Level* x);
		void _delete_Level(Level* x);
		void DestroyThread();
		boost::thread* _destroyThread;

	protected:
		typedef  HashMap<Level::ID, LvlSrdPtr> LevelMap;
		LevelMap _levels;
		LvlSrdPtr _currentLevel;
		LvlSrdPtr _Pop(Level::ID id);
		Level* _new_Level(Level::ID);

	public:
		LevelManager();
		LvlSrdPtr Create(Level::ID id);
		LvlSrdPtr Get(Level::ID);
		void Destroy(Level::ID id);
		void DestroyAll();
		void Update(TimeMS);
	};

}//GLL
